#include "anneal.h"
#include "TSP.h"
#include <iostream>
#include <cstdlib>
#include <ctime>


int main(int argc, char* argv[]){
  srand((unsigned int)(time(NULL)));
  double t0;
  std::cout << "initial temperature:" <<std::endl;
  std::cin >> t0;
  int Nl,Nt,leng;
  std::cout << "number of city:" <<std::endl;
  std::cin >> leng;
  std::cout << "length of Markov chain:" <<std::endl;
  std::cin >> Nl;
  std::cout << "number of cooling:" <<std::endl;
  std::cin >> Nt;
  city* C=load_rcity(leng);
  double startTime = clock();
  int arr[leng];
  for (int i=0; i<leng ; i++)
    arr[i]=i;
  code DNA(arr,leng);
  code best_DNA=TSPSA(DNA,C,t0,Nl,Nt);
  double endTime = clock();
  std::cout << "result:" << best_DNA.total_dis(C,leng) <<std::endl;
  put_out2(best_DNA);
  std::cout << "The run time is: " <<(double)(endTime - startTime) / CLOCKS_PER_SEC << "s" << std::endl;
  return 0;
}
